package it.multisystem.gettingstarted.geometry;

public class Point {

	private final double x;
	private final double y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public double distanceFrom(Point that) {
		double dx = this.x - that.x;
		double dy = this.y - that.y;
		
		return Math.sqrt(dx * dx + dy * dy);
	}

	public double getX() {
		return x;
	}

	public double getY() {
		return y;
	}

	public boolean belongsTo(Line line) {
		return line.contains(this);
	}
}
